#!/bin/bash

./contents.py . > contents.xml

destdir=${1%/}

if [ \( -z "$destdir" \) -o \( ! -d "$destdir" \) ]; then
    destdir=$(pwd)
fi

filename=$(pwd | xargs basename)
svn export -q --force . /tmp/$filename
cd /tmp
zip -q -r $destdir/$filename.zip $filename
rm -rf /tmp/$filename

echo Exported $destdir/$filename.zip
